package com.itheima.controller;

import com.itheima.pojo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
public class HttpSessionTest1 {
    @Autowired
    private HttpSession session;
    //会话对象，就像一个Map集合可以保存数据，浏览器每次简历会话都有一个Session对象

    @GetMapping("/loginTest1")
    public Result loginTest1(String username) {
        //把登录成功标记放到Session中
        session.setAttribute("isLogin",true);
        return Result.success();
    }




}
